package jmine.tec.subscription;

/**
 * Cache de {@link Publication}.
 * 
 * @author takeshi
 * @param <P> o tipo concreto da publication
 */
public interface PublicationStore<P extends Publication> {

    /**
     * Remove as publicacoes do store
     * 
     * @param settings {@link SubscriptionSettings}
     */
    void evict(SubscriptionSettings settings);

    /**
     * Atualiza uma publicacao
     * 
     * @param settings {@link SubscriptionSettings}
     * @param publication {@link Publication}
     * @return boolean se a publicacao passada eh mais nova que a ultima presente neste store.
     */
    boolean update(SubscriptionSettings settings, P publication);

    /**
     * @param settings {@link SubscriptionSettings}
     * @return {@link Publication}
     */
    P lastPublication(SubscriptionSettings settings);

    /**
     * Remove todas as entradas
     */
    void evictAll();

}
